<template>
  <el-container>
    <!-- 页面头部 -->
    <el-header>
      <div class="headername">
        <h3>后端管理系统</h3>
      </div>
      <div class="headeruser">
        <span>冷静的管理员</span>
        <el-avatar icon="el-icon-user-solid" :size="30"></el-avatar>
        <el-button 
        circle 
        size="mini"
        @click="userLogout"
        icon="el-icon-switch-button" ></el-button>
      </div>
      </el-header>
    <el-container>
      <!-- 页面侧边导航 -->
      <el-aside width="200px" >
        <el-menu
        default-active="/user"
        class="el-menu-vertical-demo"
        router>
          <el-menu-item index="/user">
            <i class="el-icon-user"></i>
            <span slot="title">用户管理</span>
          </el-menu-item>
          <el-menu-item index="/product">
            <i class="el-icon-sold-out"></i>
            <span slot="title">商品管理</span>
          </el-menu-item>
          <el-menu-item index="/category">
            <i class="el-icon-menu"></i>
            <span slot="title">分类管理</span>
          </el-menu-item>
          <el-menu-item index="/order">
            <i class="el-icon-s-order"></i>
            <span slot="title">订单管理</span>
          </el-menu-item>
        </el-menu>
      </el-aside>
    <el-container>
      <!-- 页面内容 -->
      <el-main>
        <!-- 路由占位符 -->
        <router-view></router-view>
      </el-main>
    </el-container>
    </el-container>
  </el-container>
</template>
<script>
export default {
  methods:{
    userLogout(){
      console.log("点击退出登录")
      this.$router.push('/login')
    }
  }
}
</script>
<style>
  *{
  padding: 0;
  margin: 0;
  }
  .el-header{
    display: flex;
    justify-content: space-between;
  }
  .el-avatar{
    margin: 0 10px;
  }
  .headeruser{
    display: flex;
    align-items: center;
  }
  .el-header, .el-footer {
    background-color: rgb(54, 144, 255);
    color: #ffffff;
    line-height: 60px;
  }
  
  .el-aside {
    background-color: rgb(255, 255, 255);
    color: #333;
    text-align: center;
    line-height: 200px;
  }
  
  .el-main {
    color: #333;
    text-align: center;
    line-height: 40px;
  }
  
  body > .el-container {
    margin-bottom: 40px;
  }
  
  .el-container:nth-child(5) .el-aside,
  .el-container:nth-child(6) .el-aside {
    line-height: 260px;
  }
  
  .el-container:nth-child(7) .el-aside {
    line-height: 320px;
  }
</style>
